package pack0623;

public class Person {
    String name = "张三";
    int age=10;
    Person(){
        name="张无忌";
        age=20;
    }
    Person(String n,int a){
        name=n;
        age=a;
    }
    public int add(int a,int b){
        return a+b;
    }
    public void sing(){System.out.println(name+"在唱歌");}
    public static void main(String[] args) {
        //创建一个人
        Person p=new Person();
        p.name ="张无忌";
        p.age = 20;
        p.sing();
        System.out.println(p.name+":"+p.age);

        int a = p.add(1,3);
        System.out.println(a);

        //创建第二个人
        Person p1 = new Person();

        p1.name = "郭靖";
        p1.age = 21;
        p1.sing();
        System.out.println(p1.name+":"+p1.age);
        int b = p1.add(3,4);
        System.out.println(b);


    }
}